//
//  HWMoWanVouchersViewController.m
//  HWanGame
//
//  Created by 陈道斌 on 2020/6/22.
//  Copyright © 2020 Chendaobin. All rights reserved.
//

#import "HWMoWanVouchersViewController.h"
#import "HWOtCgoumaijiaoyiViewController.h" // 购买
#import "HWhushouOtCViewController.h"  // 出售

@interface HWMoWanVouchersViewController ()
@property(strong,nonatomic) UIView *huiseView;
@property(strong,nonatomic) UIButton *shouRuBut;
@property(strong,nonatomic) UIButton *zhichuBut;

@property(strong,nonatomic) HWOtCgoumaijiaoyiViewController *shouruViewController;
@property(strong,nonatomic) HWhushouOtCViewController *zhichuViewController;
@property(strong,nonatomic) UILabel *promptLabel;



@end

@implementation HWMoWanVouchersViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
 
     [self xuanzhongButton];
    
     [self setupUI];
    
}




- (void)viewWillAppear:(BOOL)animated {
    
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:animated];
    [self.shouruViewController reshushuju];
    [self.zhichuViewController reshushuju];
//     [self.guandanAreViewController reshushuju];
    
    
    
}

- (void)setupUI {
    
    
    self.navigationItem.title = @"邀请记录";
    self.view.backgroundColor =  RGB(247, 247, 247);
    

    
}


- (void)xuanzhongButton {
    
    
    
       self.navigationItem.title = @"邀请记录";
       // self.view.backgroundColor = [UIColor redColor];
       self.view.backgroundColor = RGB(247, 247, 247);
       
       self.huiseView = [[UIView alloc]initWithFrame:CGRectMake(55, NavBarHeight+10, kScreenW-2*55, 40)];
       self.huiseView.backgroundColor = RGB(248, 248, 248);
       self.huiseView.backgroundColor = RGB(255, 231, 35);
       self.huiseView.layer.cornerRadius = 20;
       self.huiseView.layer.masksToBounds= YES;
     //  self.huiseView.layer.borderWidth = 1;
   //     self.huiseView.layer.borderColor = RGB(255, 231, 35).CGColor;
   //  147852258
        self.huiseView.backgroundColor = RGB(247, 247, 247);
   //  self.huiseView.backgroundColor = [UIColor redColor];
    
       [self.view addSubview: self.huiseView];
    
    
      UILabel *shulianlabel = [[UILabel alloc]initWithFrame:CGRectMake(10,self.huiseView.bottom+5, kScreenW -20, 20)];
       shulianlabel.textColor =RGB(153, 153, 153);
       shulianlabel.text = @"提示：每种每天仅可兑换一次";
             //  shulianlabel.backgroundColor = [UIColor orangeColor];
       shulianlabel.font = [UIFont systemFontOfSize:12];
       shulianlabel.textAlignment = NSTextAlignmentCenter;
       shulianlabel.hidden = YES; 
       [self.view  addSubview:shulianlabel];
     
       
       
    
    
    
    
    
    
    
       
       
       UIButton *wangjibutton = [UIButton buttonWithType:UIButtonTypeCustom];
       wangjibutton.frame = CGRectMake(0,0,  self.huiseView.width/2, 40);
       [wangjibutton setTitle:@"邀请好友" forState:UIControlStateNormal];
    [wangjibutton setTitle:[HWjianzhiduiObject keylocalization:@"邀请好友"] forState:UIControlStateNormal];
       [wangjibutton setTitleColor:RGB(32, 32, 32) forState:UIControlStateNormal];
       wangjibutton.titleLabel.font = [UIFont systemFontOfSize:15];
       wangjibutton.backgroundColor = RGB(255, 231, 35);
    
       wangjibutton.tag = 0 ;
    
    //       wangjibutton.layer.cornerRadius = 15;
//       wangjibutton.layer.masksToBounds = YES;
       self.shouRuBut = wangjibutton;
       [wangjibutton addTarget:self action:@selector(wangjibuttonTap) forControlEvents:UIControlEventTouchUpInside];
       [self.huiseView addSubview:wangjibutton];
    
    
         UIButton *zhichubutton = [UIButton buttonWithType:UIButtonTypeCustom];
         zhichubutton.frame = CGRectMake(self.huiseView.width/2 ,0,  self.huiseView.width/2, 40);
         [zhichubutton setTitle:@"获得奖励" forState:UIControlStateNormal];
    [zhichubutton setTitle:[HWjianzhiduiObject keylocalization:@"获得奖励"] forState:UIControlStateNormal];
         [zhichubutton setTitleColor:RGB(51, 51, 51) forState:UIControlStateNormal];
         zhichubutton.titleLabel.font = [UIFont systemFontOfSize:15];
         zhichubutton.backgroundColor = RGB(248, 248, 248);
          zhichubutton.tag = 1 ;
    //       wangjibutton.layer.cornerRadius = 15;
    //       wangjibutton.layer.masksToBounds = YES;
         self.zhichuBut = zhichubutton;
        [zhichubutton addTarget:self action:@selector(zhichuTap) forControlEvents:UIControlEventTouchUpInside];
    
        [self.huiseView addSubview:zhichubutton];
    
    
    

    
    
    

       self.shouruViewController = [[HWOtCgoumaijiaoyiViewController alloc]init];
       [self addChildViewController:self.shouruViewController];
    
    
      self.shouruViewController.view.frame = CGRectMake(0,  NavBarHeight+10+40+25, kScreenW,kScreenH -  (NavBarHeight+10+40+25));
      [self.view addSubview: self.shouruViewController.view];
    
    
    
       self.zhichuViewController = [[HWhushouOtCViewController alloc]init];
       [self addChildViewController:self.zhichuViewController];


       self.zhichuViewController.view.frame = CGRectMake(0,  NavBarHeight+10+40+25, kScreenW,kScreenH -  (NavBarHeight+10+40+25));
       [self.view addSubview: self.zhichuViewController.view];
       [self wangjibuttonTap];
    
    
    
    
    
     
    
    
    
    
    
}

// 兑换
- (void)wangjibuttonTap {
    
    
    self.shouRuBut.backgroundColor  =  RGB(244, 106, 5);
    [self.shouRuBut  setTitleColor:RGB(255, 255, 255) forState:UIControlStateNormal];
    
    self.zhichuBut.backgroundColor = RGB(255, 255, 255);
    [self.zhichuBut  setTitleColor:RGB(136, 136, 136) forState:UIControlStateNormal];
    
    
    self.shouruViewController.view.hidden  = NO;
    self.zhichuViewController.view.hidden = YES;
  
    
    
    
    
    

    
}

//领取
-(void)zhichuTap {
    
    
    
    self.shouRuBut.backgroundColor  =  RGB(255, 255, 255);
    [self.shouRuBut  setTitleColor:RGB(136, 136, 136)  forState:UIControlStateNormal];
    
    self.zhichuBut.backgroundColor =  RGB(244, 106, 5);
    [self.zhichuBut  setTitleColor:RGB(255, 255, 255) forState:UIControlStateNormal];
 
    
    
    self.shouruViewController.view.hidden  = YES;
    self.zhichuViewController.view.hidden = NO;
 
}




-(void)setNoteStr:(NSString *)noteStr {
    _noteStr = noteStr;
    
    
    
}






 

@end
